home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / lblcs.arc / CRT.DOC < prev    next >
Text File  |  1985-05-08  |  15KB  |  471 lines

  1.  
  2. In order to save paper, the following function descriptions are 
  3. "squashed" together.  You can use your favorite word processor
  4. to print them out, one per page, if you prefer... 
  5.  
  6.  
  7. ;------------------------------------------------------------
  8. ; name        crt_ps320sg 
  9. ;
  10. ; synopsis    crt_ps320sg(segment, offset, row, col, color)
  11. ;        int    segment;    /* 0xb000=mono    0xb800=color    */
  12. ;        int    offset;        /* use 0 for graphics adaptor    */
  13. ;        int    row;        /*  row number 0 to 199        */
  14. ;        int    col;        /*  col number 0 to 399        */
  15. ;        int    color;        /*  color      0 to 3        */
  16. ;
  17. ; description    This subroutine sets a point on the 320 x 200
  18. ;        graphics screen.  Hand coded in assembly, It
  19. ;        operates 8 - 10 times faster than the corres-
  20. ;        ponding BIOS call.  
  21. ;
  22. ; notes        This routine will treat any passed segment value 
  23. ;        like an interlaced graphics adaptor.  It could 
  24. ;        just as well be a block of memory that has been
  25. ;        allocated, (i.e. a graphics buffer that is to be moved
  26. ;        to the screen after a group of points are set ),
  27. ;        or some other segment value for a non-PC compatible
  28. ;        display.  If you are addressing the display adaptors,
  29. ;        use an offst of 0.  If you are handling a buffer, use
  30. ;        the buffers segment and offset.  Large model pointers
  31. ;        must be broken into segment and offset which are 
  32. ;        passed separately.  
  33. ;        
  34. ;        This routine handles graphics interlacing 
  35. ;        (normal IBM PC graphics).  It would not function
  36. ;        on a machine that does not interlace graphics -
  37. ;        i.e. the Tandy T2000.
  38. ;
  39. ;        If you pass the correct segment value based on the 
  40. ;        equipment flag setting, this routine will work on
  41. ;        both a color and mono display adaptor.
  42. ;         
  43. ; bugs        row, col, and color are not validated - make sure
  44. ;        they are in range or you could crash the system. 
  45. ;
  46. ;------------------------------------------------------------
  47.  
  48.  
  49. ;------------------------------------------------------------
  50. ;
  51. ; name        crt_setborder - set border color 
  52. ;
  53. ; synopsis    VOID    crt_setborder(color)
  54. ;            int    color;
  55. ;
  56. ; description    set border to specified color (0-15)
  57. ;
  58. ;------------------------------------------------------------    
  59.  
  60.  
  61. ;------------------------------------------------------------
  62. ;
  63. ; name        crt_cls - clear screen using BIOS scroll up call
  64. ;
  65. ; synopsis     VOID    crt_cls()
  66. ;
  67. ;
  68. ; description    This function clears your 80 x 24 screen using the
  69. ;        BIOS scroll up function.  For graphics uses, you
  70. ;        should use crt_scrollu with the appropriate 
  71. ;        background attribute - crt_cls assumes text mode.
  72. ;
  73. ;
  74. ; notes        This routine works only on the currently selected 
  75. ;        (active) page.  It uses the "normal" (07) attribute
  76. ;        on scrolled lines.  Unlike the CI-C86 function with
  77. ;        the same name, it does not home the cursor.   
  78. ;
  79. ;------------------------------------------------------------
  80.  
  81.  
  82.  
  83. ;------------------------------------------------------------
  84. ;
  85. ; name        crt_cls2 -- clear screen or graphics buffer
  86. ;
  87. ; synopsis    crt_cls2(segment,offset)
  88. ;            int segment;    
  89. ;            int offset;
  90. ;
  91. ;
  92. ; description    this routine uses the REP MOVSW instruction for fast
  93. ;        clearing of the screen or a graphics buffer. Use segment
  94. ;        0xb000 and offset 0 for mono, segment 0xb800 and offset
  95. ;        0 for color.  To clear a graphics buffer, use the appro-
  96. ;        priate segment and offset values.  Large model pointers
  97. ;        must be separated into segment and offset values which
  98. ;        must be passed separately.
  99. ;
  100. ; notes        on some machines, this routine is significantly faster
  101. ;        than a screen clear using the BIOS screen scroll up
  102. ;        routine.  
  103. ;
  104. ;        DI register destroyed.  ES register used and
  105. ;        then restored.
  106. ;
  107. ;        If used in text modes, it clears ALL text pages.
  108. ;------------------------------------------------------------
  109.  
  110.  
  111.  
  112. ;------------------------------------------------------------
  113. ;
  114. ; name        crt_getca - get character and attribute at cursor position
  115. ;
  116. ; synopsis    VOID    crt_getca(page)
  117. ;            int    page;
  118. ;  
  119. ; description    Reads character and attribute under cursor on
  120. ;        video page number "page". On return, character
  121. ;        in low byte ( ch = crt_getca(0) & 255), and 
  122. ;        attribute is in high byte ( atr = crt_getca(0) >> 8).
  123. ; notes        use crt_gotoxy to position cursor to desired row, 
  124. ;        col, and page. 
  125. ;
  126. ;------------------------------------------------------------
  127.  
  128.  
  129. ;------------------------------------------------------------
  130. ;
  131. ; name        crt_getxy - get current cursor setting
  132. ;
  133. ; synopsis    int    crt_getxy(page)
  134. ;            int     page;
  135. ;  
  136. ; description    returns the current cursor setting in page # "page".
  137. ;        In text mode, it is possible to have up to 8 different 
  138. ;        pages, all with different cursor settings. 
  139. ;
  140. ; example    rc = crt_getxy(0);
  141. ;        column =  rc & 0xff;    /* col is lower byte        */
  142. ;        row    =  rc >> 8;    /* row is upper byte          */
  143. ;                    /* an interesting alternative    */
  144. ;                    /* to the above: row=rc % 0x100    */
  145. ;
  146. ;------------------------------------------------------------
  147.  
  148.  
  149. ;------------------------------------------------------------
  150. ;
  151. ; name        crt_gotoxy - cursor set
  152. ;
  153. ; synopsis    VOID    crt_gotoxy(row, col, page)
  154. ;            int row;
  155. ;            int col;
  156. ;            int page;
  157. ;
  158. ; description    This function does a cursor position set to 
  159. ;        row, col on the specified page.  (0--7 in 40
  160. ;        column mode; 0--3 in 80 column mode)  It does
  161. ;        not, however actually change the current text
  162. ;        page. (See crt_setpage function)
  163. ;
  164. ;------------------------------------------------------------
  165.  
  166.  
  167. ;------------------------------------------------------------
  168. ;
  169. ; name        crt_home -- home cursor on given page
  170. ;
  171. ; synopsis    VOID crt_home(page)
  172. ;            int    page;
  173. ;
  174. ; description    sets cursor to 0,0 on selected page.  This routine 
  175. ;        differs slightly from the CI-C86 function with the
  176. ;        same name - the CIC86 function always assumes page 0.
  177. ;
  178. ; notes        There is basically no difference between doing a
  179. ;        crt_home and a crt_goto to row 0, col 0. 
  180. ;
  181. ;     
  182. ;------------------------------------------------------------
  183.  
  184.  
  185.  
  186.  
  187. /************************************************************
  188.  *
  189.  * name        crt_line -- plot lines w/ BIOS point set routine
  190.  *
  191.  * synopsis    crt_line(row1,col1,row2,col2,color);        
  192.  *        int row1,col2,row2,color;
  193.  *
  194.  * description    This routine uses an octantal DDA to plot 
  195.  *        lines on your graphics screen.  The screen 
  196.  *        needs to be set to graphics mode, of course...
  197.  *
  198.  * notes    This routine is still written in 'C'.  It is faster 
  199.  *        than many of the other line draw routines I have seen
  200.  *        around, but still relatively slow compared to assembler.
  201.  *
  202.  *        Since this routine uses the BIOS point set routine,
  203.  *        it will run on color or mono display adaptors, in
  204.  *        any supported graphics mode.  The disadvantage of 
  205.  *        using the BIOS point set routine is that it is
  206.  *        extremely slow.....  The speed of this routine is
  207.  *        entirely limited by the speed of the BIOS pset call. 
  208.  * 
  209.  * bugs        Better be sure that your x and y values are in range
  210.  *        no range checking is done.
  211.  ********************************************************************/
  212.  
  213.  
  214.  
  215. /******************************************************************
  216.  *
  217.  * name        crt_line320 -- plot lines w/ fast 320x200 point routine
  218.  *
  219.  * synopsis    crt_line320(row1, col2, row2, col2, color)
  220.  *        int row1,col2,row2,col2,color;
  221.  *
  222.  * description    This routine uses a simple octantal DDA to plot 
  223.  *        lines on your 320 x 200 COLOR graphics screen.  The
  224.  *        screen needs to be set to graphics mode, of course...
  225.  *
  226.  * notes    This routine is still written in 'C'.  It is faster 
  227.  *        than many of the other line draw routines I have seen
  228.  *        around, but still relatively slow compared to assembler.
  229.  *        Next released version of the libraries will have this 
  230.  *        one written in assembler...
  231.  *
  232.  *        Works only in 320x200 color graphics mode!!
  233.  * 
  234.  * bugs        Better be sure that your x and y values are in range
  235.  *        no range checking is done.
  236.  ********************************************************************/
  237.  
  238.  
  239.  
  240. ;------------------------------------------------------------
  241. ;
  242. ; name        crt_setmode - set screen mode
  243. ;
  244. ; synopsis    VOID    crt_setmode(mode)
  245. ;            int    mode;
  246. ;
  247. ; description      Set screen to graphics or text mode.
  248. ;
  249. ;
  250. ;        TEXT MODES
  251. ;        -------------------------------
  252. ;        0    =    40 x 25  monochrome
  253. ;        1    =    40 x 25  color        
  254. ;        2    =    80 x 25  monochrome    
  255. ;        3    =    80 x 25  color        
  256. ;
  257. ;        GRAPHICS MODES
  258. ;        -------------------------------
  259. ;        4    =    320 x 200 color        
  260. ;        5    =    320 x 200 monochrome    
  261. ;        6    =    640 x 400 monochrome    
  262. ;        7    =    unknown
  263. ;
  264. ;        OTHER MODES    (some require HI-RES board)
  265. ;        -------------------------------
  266. ;        8    =    640 x 400 color        
  267. ;        9    =    640 x 400 monochrome    
  268. ;                10    =    160 x 200 color (16 colors)
  269. ;
  270. ;------------------------------------------------------------
  271.  
  272.  
  273. ;------------------------------------------------------------
  274. ;
  275. ; name        crt_getmode -- get current video mode
  276. ;
  277. ; synopsis    int    crt_getmode()
  278. ;
  279. ; description    Returns current value of mode setting.
  280. ;        See set_mode for further info about modes.
  281. ;
  282. ;------------------------------------------------------------
  283.  
  284.  
  285.  
  286. ;------------------------------------------------------------
  287. ;
  288. ; name        crt_pread -- return color of pixel on graphics screen 
  289. ;
  290. ; synopsis    int color;
  291. ;        color = crt_pread(row, col);
  292. ;        int  row, col;
  293. ;
  294. ; description    This routine reads the color of the pixel on
  295. ;        a graphics screen.  It uses the BIOS "read-a-
  296. ;        points-color" routine, so it functions on any
  297. ;        type of monitor and under all graphics modes.
  298. ;
  299. ; notes        I  have no idea what happens if you attempt to call
  300. ;        the BIOS routine with crazy row and column values.
  301. ;
  302. ;------------------------------------------------------------
  303.  
  304.  
  305.  
  306. ;------------------------------------------------------------
  307. ; name        crt_ps320 
  308. ;
  309. ; synopsis    crt_ps320(row,col,color)
  310. ;        int    row;        /*  row number 0 - 199    */
  311. ;        int    col;        /*  col number 0 - 399    */
  312. ;        int    color;        /*  color      0 - 3    */
  313. ;
  314. ; description    This subroutine sets a point on the 320 x 200
  315. ;        graphics screen.  Hand coded in assembly, It
  316. ;        operates 8 - 10 times faster than the corres-
  317. ;        ponding BIOS call.  
  318. ;
  319. ; notes        This is a COLOR ONLY routine since it assumes
  320. ;        that a color adaptor is available in the 0xb800 
  321. ;        segment.
  322. ;        
  323. ;        This routine handles graphics interlacing 
  324. ;        (normal IBM PC graphics).  It would not function
  325. ;        on a machine that does not interlace graphics -
  326. ;        i.e. the Tandy T2000.
  327. ;
  328. ;        If you need a routine that works on both mono 
  329. ;        and color, see crt_320s or crt_pset
  330. ;         
  331. ; bugs        row, col, and color are not validated -- make sure
  332. ;        they are in range or you could crash the system. 
  333. ;
  334. ;
  335. ;------------------------------------------------------------
  336.  
  337.  
  338.  
  339. ;------------------------------------------------------------
  340. ;
  341. ; name        crt_pset -- use BIOS call to set point
  342. ;
  343. ; synopsis    crt_pset( row, col, color)
  344. ;        int    row,col,color;
  345. ;
  346. ; description    this routine uses the BIOS "set a point call", so it 
  347. ;        can be used in mono or color in any graphics mode.  The
  348. ;        major draw--back to using the BIOS call is that it
  349. ;        is SLOOOOW when compared to routines that set points
  350. ;        in specific graphics modes.
  351. ;
  352. ; notes        legal row, col, and color values depend on the 
  353. ;        particular graphics modes set.
  354. ;
  355. ;------------------------------------------------------------
  356.  
  357.  
  358.  
  359. ;------------------------------------------------------------
  360. ;
  361. ; name        crt_putcamult -- put multiple characters with attribute
  362. ;
  363. ; synopsis    VOID    crt_putcamult(ch, page, count)
  364. ;        int ch, page, count;
  365. ;
  366. ;  
  367. ; description    write character and attribute at current cursor location
  368. ;        high byte of ch is attribute, low byte is character
  369. ;
  370. ;        page is page # to place text on (text modes only)
  371. ;
  372. ;        Count is # of times to put character (good for top
  373. ;        and bottom of boxes).
  374. ;
  375. ;------------------------------------------------------------
  376.  
  377.  
  378. ;------------------------------------------------------------
  379. ;
  380. ; name        crt_putch -- put character only at current cursor
  381. ;
  382. ; synopsis    VOID    crt_putch(ch, page, count)
  383. ;            int ch, page, count;
  384. ;
  385. ;  
  386. ; description    Write character only at current cursor location --
  387. ;        existing attributes are used.
  388. ;
  389. ; notes        Page is page # to place text on (text modes only).
  390. ;
  391. ;        Count is # of times to put character.
  392. ;
  393. ;------------------------------------------------------------
  394.  
  395.  
  396.  
  397. ;------------------------------------------------------------
  398. ;
  399. ; name        crt_scrolld -- scroll screen down
  400. ;
  401. ; synopsis    VOID    crt_scrolld(ulrow,ulcol,lrrow,lrcol,count,attrib)
  402. ;
  403. ;        int    ulrow;        upper left row
  404. ;        int    ulcol;        upper left column
  405. ;        int    lrrow;        lower right row
  406. ;        int    lrcol;        lower right column
  407. ;        int    count;        # lines to scroll ( 0=whole window )
  408. ;        int    attrib;        attribute used on blank lines
  409. ;
  410. ; description    scrolls the window specified by "ulcol", "ulrow",
  411. ;        "lrcol", "lrrow" down by "count" lines using "attrib"
  412. ;        on each blank line.  If "count" is 0, the entire
  413. ;        screen is scrolled.
  414. ;
  415. ;------------------------------------------------------------    
  416.  
  417.  
  418. ;------------------------------------------------------------
  419. ;
  420. ; name        crt_scrollu -- scroll screen up
  421. ;
  422. ; synopsis    VOID    crt_scrollu(ulrow,ulcol,lrrow,lrcol,count,attrib)
  423. ;        int    ulrow;        upper left row
  424. ;        int    ulcol;        upper left column
  425. ;        int    lrrow;        lower right row
  426. ;        int    lrcol;        lower right column
  427. ;        int    count;        # lines to scroll ( 0=whole window )
  428. ;        int    attrib;        attribute used on blank lines
  429. ;
  430. ; description    scrolls the window specified by "ulcol", "ulrow",
  431. ;        "lrcol", "lrrow" up by "count" lines using "attrib"
  432. ;        on each blank line.  If "count" is 0, the entire
  433. ;        screen is scrolled.
  434. ;
  435. ;------------------------------------------------------------    
  436.  
  437.  
  438. ;------------------------------------------------------------
  439. ;
  440. ; name        crt_setpage -- set current text page
  441. ;
  442. ;
  443. ; synopsis    VOID    crt_setpage(page)
  444. ;            int    page;
  445. ;  
  446. ; description    Sets current active video page number to "page".
  447. ;        Used in text mode only.  Valid page #'s are 0--3 for
  448. ;        80 x 25 display and 0--7 for 40 x 25 display. 
  449. ;
  450. ;
  451. ;------------------------------------------------------------
  452.  
  453.  
  454. ;---------------------------------------------------------------
  455. ;
  456. ; name        msc_getversion    - get library version
  457. ;
  458. ; synopsis    int vers;
  459. ;        vers = msc_getversion();
  460. ;
  461. ;        printf("\nlibrary version:  %2d . %02d",vers>>8,vers&255);
  462. ;
  463. ; description:    returns library version which can be printed as in
  464. ;        the synopsis above.
  465. ;
  466. ;--------------------------------------------------------------
  467.  
  468.  
  469.